package com.bjesc_b2c.app.appraiset.adapter;

import android.content.Context;
import android.text.TextUtils;

import com.bjesc_b2c.app.appraiset.R;
import com.facebook.drawee.backends.pipeline.Fresco;
import com.facebook.imagepipeline.core.ImagePipeline;

import java.util.List;

import app.pinggushi.bjesc.com.baserecyclerview.adapter.CommonAdapter;
import app.pinggushi.bjesc.com.baserecyclerview.adapter.base.ViewHolder;
import master_bean.CarSourcePhotoBean;

/**
 * Created by yidong on 2017/8/23.
 */

public class FollowPhotoAdapter extends CommonAdapter<CarSourcePhotoBean> {
    public FollowPhotoAdapter(Context context, int layoutId, List<CarSourcePhotoBean> datas) {
        super(context, layoutId, datas);
    }

    @Override
    protected void convertView(ViewHolder holder, CarSourcePhotoBean bean, int position) {
        holder.setIsRecyclable(false);// //强制关闭复用   或者显示默认图片
        ImagePipeline imagePipeline = Fresco.getImagePipeline();
        imagePipeline.clearCaches();
        if(!TextUtils.isEmpty(bean.getPhoto())){
            if(bean.getPhoto().contains("http")){
                holder.setFrescoUrl(R.id.fresc_follow_photo,bean.getPhoto(),true);
            }else{
                holder.setFrescoFile(R.id.fresc_follow_photo,bean.getPhoto(),true);
            }
        }
    }
}
